1. /* slfeulnm.cpp by K.Tsuru */
  2. // function ID 4101 DRADIX
  3. /****************************************************************
  4. SLong class
  5. It provides a n-th Euler's number En by use of combination number.
  6. *****************************************************************/
  7. #ifndef SN_H
  8. #include "sn.h"
  9. #endif
  10. SLong EulerNum(uint N)
  11. {
  12. if(N < 2) return 1;
  13. uint j, m;
  14. SLong sum, f;
  15. if(N >= f.Radix()/2u) f.SetError(f.OUT_OF_RANGE,"EulerNum", 4101);
  16. SLong* E = new SLong[N + 1];
  17. E[0].SetLong(1);
  18. for(m = 1; m <= N; m++){
  19. sum.SetZero(); // = 0.0;
  20. for(j=1; j <= m ; j++){
  21. f = combL(2*m, 2*j)*E[m-j];
  22. if(j & 1) sum += f;
  23. else sum -= f;
  24. }
  25. E[m]=sum;
  26. }
  27. delete[] E;
  28. return sum;
  29. }

slfeulnm.cpp : last modifiled at 2016/10/10 11:05:52(744 bytes)
created at 2017/10/07 10:26:50
The creation time of this html file is 2017/11/09 14:52:03 (Thu Nov 09 14:52:03 2017).